﻿@{
    Layout = null;
    var user = ViewBag.User as User;
    var address = ViewBag.Address as List<UserAddress>;
    var product = ViewBag.Product as Product;
}
@model Order;
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>添加</title>
    <link href="/layui/css/layui.mobile.css" rel="stylesheet" />
    <link href="/layui/css/layui.css" rel="stylesheet" />
    <script src="/js/vue.js"></script>
    <script src="/layui/layui.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>

    <div style="width:100px;text-align:center;">
        <div class="layui-card">
            <div class="layui-card-header"></div>
            <div class="layui-card-body">
                <form class="layui-form" >

                    <input type="hidden" name="OrderId" value="@Model.Id" autocomplete="off" class="layui-input">
                    <input type="hidden" name="ProductId" value="@Model.Ext1" autocomplete="off" class="layui-input">
                    <input type="hidden" name="UnitPrice" value="@Model.TotalMoney" autocomplete="off" class="layui-input">
                    <input type="hidden" name="Num" value="1" autocomplete="off" class="layui-input">

                    <input type="hidden" name="Describe" value="" autocomplete="off" class="layui-input">
                    <button type="submit" id="login-button" class="layui-btn" style="float:right" lay-submit lay-filter="addForm">添加</button>
                </form>
            </div>
        </div>
    </div>
    <script>
        layui.use(["form", 'layer'], function() {
            var form = layui.form;
            var $ = layui.$;
            var layer = layui.layer;
            //提交
            form.on('submit(addForm)', function(data) {
                $.post("/order/OrderDetailCreate", data.field, function(res) {
                    if (res.isSuccess) {
                        layer.msg(res.msg, function() {
                            parent.window.location.href = "/zhifu/index/"+@Model.Id;
                        });
                    } else {
                        layer.msg(res.msg);
                    }
                });
                return false;
            });
        })
    </script>
</body>
</html>